{{ $consultingVendorsPath := (printf "data/%s/vendors/consulting.toml" $.Language.Lang) }}

{{ $consultingVendorsData := "" }}
{{ if (fileExists $consultingVendorsPath) -}}
  {{ $data := index .Site.Data $.Language.Lang }}
  {{ $consultingVendorsData = $data.vendors }}
{{ else }}
  {{ $dataDefaultLanguage := index .Site.Data .Sites.First.Language.Lang }}
  {{ $consultingVendorsData = $dataDefaultLanguage.vendors }}
{{ end }}

{{ with $consultingVendorsData.consulting }}
  {{ if $.Params.grouped }}
    <h3>{{ i18n "africa" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "africa" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
    <h3>{{ i18n "asia" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "asia" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
    <h3>{{ i18n "australia" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "australia" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
    <h3>{{ i18n "europe" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "europe" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
    <h3>{{ i18n "newZealand" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "nzealand" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
    <h3>{{ i18n "northAmerica" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "namerica" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
    <h3>{{ i18n "southAmerica" }}</h3>
    <ul>
      {{ range (sort .consulting "name" "asc") }}
        {{ if eq .category "samerica" }}
          <li><a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a></li>
        {{ end }}
      {{ end }}
    </ul>
  {{ else }}
    <dl>
      {{ range (sort .consulting "name" "asc") }}
        <dt>
          <a id="{{ .id }}" name="{{ .id }}" href="{{ .url }}">{{ .name }}</a>
        </dt>
        <dd>
          {{ .description | safeHTML }}
        </dd>
      {{ end }}
    </dl>
  {{ end }}
{{ end }}
